package com.todo.event.activity.infrastructure.repository;

import com.todo.event.activity.common.enums.ExecuteRecordStatusEnum;
import com.todo.event.activity.infrastructure.entity.po.EventActivityTouchRecordPO;

import java.util.Date;
import java.util.List;

/**
 * @author azhebuxing
 * @date 2025/1/15 14:27
 * @description
 */
public interface EventActivityTouchRecordRepository {

    /**
     * 插入活动触达记录
     *
     * @param eventActivityRecordPO
     * @return
     */
    Boolean insertActivityTouchRecord(EventActivityTouchRecordPO eventActivityRecordPO);

    /**
     * 更新活动执行触达记录状态
     *
     * @param id
     * @param oldStatus
     * @param newStatus
     * @return
     */
    Boolean updateActivityTouchRecordStatus(Long id, ExecuteRecordStatusEnum oldStatus, ExecuteRecordStatusEnum newStatus);

    /**
     * 根据活动Id和唯一键查询活动触达记录
     *
     * @param activityId
     * @param uk
     * @return
     */
    EventActivityTouchRecordPO queryRecordByActivityIdAndUK(Long activityId, String uk);

    /**
     * 根据状态查询某一区间段内的所有主键Id
     *
     * @param status
     * @param startTime
     * @param endTime
     * @return
     */
    List<Long> queryStatusRecordIdListByTime(ExecuteRecordStatusEnum status, Date startTime, Date endTime);

    /**
     * 根据主键Id查询活动触达记录
     *
     * @param idList
     * @return
     */
    List<EventActivityTouchRecordPO> queryRecordListByIdList(List<Long> idList);

    /**
     * 更新活动触达记录基本信息
     *
     * @param recordId
     * @param propertyCode
     * @param retryCount
     * @param recordStatus
     * @return
     */
    boolean updateActivityTouchRecordBaseInfo(Long recordId, String propertyCode, Integer retryCount, ExecuteRecordStatusEnum recordStatus);
}
